<template>
	<view class="notice_box flex_s">
		<view class="icon_box flex_c">
			<view class='iconfont icon-laba'></view>
		</view>
		<swiper class="swiper_box" :vertical="true" circular autoplay :interval="2000">
			<swiper-item v-for="(item,index) in noticeList" :key='index'>
				<view class="info_box flex_sb" @click="$util.JumpPath(item.chiild[1].val)" id="out">
					<view class="notice_item flex_s line1" id="in">
						{{item.chiild[0].val}}
					</view>
					<view class='iconfont icon-xiangyou'></view>
				</view>
			</swiper-item>
		</swiper>


	</view>
</template>

<script>
	export default {
		name: "notice",
		props: {
			noticeList: {
				type: Array,
				default: []
			}
		},
		data() {
			return {
				run: false
			};
		},
		mounted() {
			var _this = this;
			this.$nextTick(() => {
				// let out = _this.$refs.out.clientWidth;
				// let _in = _this.$refs.in.clientWidth;
				// _this.run = _in > out ? true : false;
				setTimeout(()=>{
					console.log("-------------");
					uni.createSelectorQuery().select('#in').boundingClientRect(res => {
						if (res) {
							console.log('元素宽度:', res.width);
							console.log('元素高度:', res.height);
						}
					}).exec()
				},3000)

				// console.log(_this.$refs.in, "---------");
			});
		},
		watch: {
			content() {
				var _this = this;
				setTimeout(() => {
					_this.$nextTick(() => {
						let out = _this.$refs.out.clientWidth;
						let _in = _this.$refs.in.clientWidth;
						_this.pWidth = 2 * _in;
						_this.run = _in > out ? true : false;
					});
				}, 0);
			}
		},
	}
</script>

<style lang="scss" scoped>
	.notice_box {
		/* #ifdef MP */
		width: 702rpx;
		/* #endif */
		/* #ifdef H5 */
		width: 90vw;
		min-width: 702rpx;;
		/* #endif */
		
		height: 60rpx;
		line-height: 60rpx;
		border-radius: 12rpx;
		background: #fff;
		overflow: hidden;
		margin: 20rpx auto;
		padding: 0rpx 24rpx;

		.icon_box {
			flex-shrink: 0;
			width: 24rpx;
			height: 24rpx;
			line-height: 0;
			margin-right: 8rpx;

			.iconfont {
				font-size: 28rpx;
				color: #BA0006;
			}
		}

		.swiper_box {
			width: 100%;
			height: 100%;


			.notice_item {
				width: 89%;
				font-size: 26rpx;
				color: #383838;

				.price {
					color: #D43030;
				}
			}

			.iconfont {
				font-size: 28rpx;
				color: #888;
			}
		}

		.text_box {
			margin-left: 10rpx;
		}
	}
</style>